﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SCRUM.Core.BusinessObjects
{
    /// <summary>
    /// Business object that holds information about users in roles in teams
    /// </summary>
    [Serializable()]
    public class UserInRole : BusinessObject
    {
        /// <summary>
        /// Gets or sets the user ID.
        /// </summary>
        /// <value>The user ID.</value>
        public int UserID { get; set; }

        /// <summary>
        /// Gets or sets the name of the user.
        /// </summary>
        /// <value>The name of the user.</value>
        public string UserName { get; set; }

        /// <summary>
        /// Gets or sets the full name of user in role
        /// </summary>
        /// <value>The full name.</value>
        public string FullName { get; set; }

        /// <summary>
        /// Gets or sets the role ID.
        /// </summary>
        /// <value>The role ID.</value>
        public int RoleID { get; set; }

        /// <summary>
        /// Gets or sets the name of the role.
        /// </summary>
        /// <value>The name of the role.</value>
        public string RoleName { get; set; }

        /// <summary>
        /// Gets or sets the team ID.
        /// </summary>
        /// <value>The team ID.</value>
        public int TeamID { get; set; }

        /// <summary>
        /// Gets or sets the name of the team.
        /// </summary>
        /// <value>The name of the team.</value>
        public string TeamName { get; set; }

        /// <summary>
        /// Gets the name + login for user
        /// </summary>
        /// <value>The name of the extended user.</value>
        public string ExtendedUserName { 
            get 
            { 
                return String.Format("{0} ({1})", this.FullName, this.UserName); 
            } 
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="UserInRole"/> class.
        /// </summary>
        /// <param name="userID">The u ID.</param>
        /// <param name="userName">Name of the u.</param>
        /// <param name="roleID">The r ID.</param>
        /// <param name="roleName">Name of the r.</param>
        /// <param name="teamID">The t ID.</param>
        /// <param name="teamName">Name of the t.</param>
        public UserInRole(int id, int userID, string userName, string fullName, int roleID, string roleName, int teamID, string teamName)
            :base(id)
        {
            this.UserID = userID;
            this.UserName = userName;
            this.FullName = fullName;
            this.RoleID = roleID;
            this.RoleName = LocalizeString("Role", roleName);
            this.TeamID = teamID;
            this.TeamName = teamName;
        }
    }
}
